
export function uclaAnalyzeResults(userAnswers) {
	let totalScore = 0;

	// 遍历用户答案，计算每个因子的总分
	userAnswers.forEach((answer) => {
		const questionId = answer.questionId; // 题目 ID
		const score = parseInt(answer.answer); // 用户得分
		totalScore += score;
	});

	// 判断风险等级
	let riskLevel = "不孤独";
	if (totalScore > 0) {
		riskLevel = "低度孤独";
	}
	if (totalScore > 28) {
		riskLevel = "一般偏下孤独";
	}
	if (totalScore > 33) {
		riskLevel = "一般孤独";
	}
	if (totalScore > 39) {
		riskLevel = "一般偏上孤独";
	}
	if (totalScore > 44) {
		riskLevel = "高度孤独";
	}
	// 返回分析结果
	return {
		riskLevel,
		totalScore
	};
}